
#include "c_common.h"


/** 创建多级目录 */
void mkdirs( char *muldir )
{
	int	i, len;
	char	str[512];
	strncpy( str, muldir, 512 );
	len = strlen( str );
	for ( i = 0; i < len; i++ )
	{
		if ( str[i] == '/' )
		{
			str[i] = '\0';
			if ( access( str, 0 ) != 0 )
			{
				mkdir( str, 0777 );
			}
			str[i] = '/';
		}
	}
	if ( len > 0 && access( str, 0 ) != 0 )
	{
		mkdir( str, 0777 );
	}
	return;
}


